package com.niit.main;

import com.niit.mapper.StudentMapper;
import org.apache.ibatis.session.SqlSession;

import com.niit.util.MybatisUtil;

/**
 * 根据班级名称查询班级人数
 *
 * @author hanliang
 */
public class Test01_2_CountByBatchName {

    public static void main(String[] args) {

        String batchName = "22软件外包01班";
        int count=0;

		try (SqlSession session = MybatisUtil.openSession()) {
//			count=session.selectOne("getBatchSize",batchName);

            StudentMapper studentMapper = session.getMapper(StudentMapper.class);
            count=studentMapper.getBatchSize(batchName);
		}
        
        System.out.println("-------------------------------------------------------------------------------------------");
        System.out.println("班级人数： "+count);


//        System.out.println("select * from student where id="+id); // STATEMENT
//        System.out.println("select * from student where id=?");   // PREPARED

    }
}
